import React from "react"
import { Card, Form, Button, Image } from 'antd-mobile'
import './index.css'

interface IProps {
    props: any
}

const MerchantCard: React.FC<IProps> = ({ props }) => {
    const { merchantName, logoUrl, monthSell, percentPrice, id } = props
    const handleClick = () => {
        localStorage.setItem('merchantName', merchantName)
        localStorage.setItem('monthSell', monthSell)
        localStorage.setItem('percentPrice', percentPrice)
        localStorage.setItem('id', id)
        localStorage.setItem('logoUrl', logoUrl)
        window.location.href = 'http://121.43.147.142:3000/#/productDetail'
    }

    // http://121.43.147.142:3000
    return (
        <Card
            style={{ borderRadius: 0 }}
            onClick={handleClick}
        >
            <div className="merchant-card-content">
                <div className="merchant-card-content-img"><Image style={{height: '100%', width: '100%'}} src={logoUrl} /></div>
                <div className="merchant-card-content-info">{merchantName} <div style={{ color: '#999', marginTop: 30, fontSize: 14 }}>月售{monthSell} 人均￥{percentPrice}</div></div>
            </div>
        </Card>
    )
}

export default MerchantCard